﻿/********************************************************************************
** @ Date:2025/05/12
** @ Author: Gaojia
** @ Description: 相机数据类
** @ Version:1.0.0
** @ Fun:
********************************************************************************/
#ifndef CDevDataCam_H
#define CDevDataCam_H
#include "HCNetSDK.h"
#include <QString>
#include <QPointF>
#include <QMap>
struct STRU_CHANNEL_INFO
{
	char    chChanName[40];     //通道名称
	int		iChanIndex;			//监控通道号 = 数组索引+startchan
	int		iPicResolution;	    //图片分辨率
	int		iPicQuality;	    //图片质量
	char	chAccessChanIP[16]; //ip接入通道的ip地址
	BOOL    bEnable;            //是否有效
	NET_DVR_DECODERCFG_V30  struDecodercfg;   //通道的解码器信息
	STRU_CHANNEL_INFO()
	{
		chChanName[0] = '\0';
		iChanIndex = -1;
		iPicResolution = 0;
		iPicQuality = 2;
		chAccessChanIP[0] = '\0';
		bEnable = FALSE;
	}
};

struct STRU_DEVICE_INFO
{
	LONG    lLoginID;
	int		iDeviceChanNum;		    //设备的通道数
	int		iStartChan;				//设备开始通道号
	int 	iIPChanNum;				//最大数字通道个数
	int 	iIPStartChan;			//数字通道起始通道号
	int		iEnableChanNum;			//有效通道数
	BOOL    bIPRet;                 //是否支持ip接入

	STRU_CHANNEL_INFO struChanInfo[MAX_CHANNUM_V30];


	LONG lDefenseHandle;//布防Handle addwxy


	STRU_DEVICE_INFO()
	{
		lLoginID = -1;
		iDeviceChanNum = -1;
		iStartChan = 0;
		iIPChanNum = 0;
		iEnableChanNum = -1;
		bIPRet = FALSE;

		lDefenseHandle = 0;//布防Handle addwxy
	}
};


struct SCamerInfo
{
	NET_DVR_CLIENTINFO m_cClientInfo;           //软解码预览参数结构体对象
	int                m_nDevTypeCode;          //相机设备类型编码   
	bool               m_bConStatus;            //设备连接状态    0未连接  1已连接 
	bool               m_bIsRecording;          //是否正在录像
	bool               m_bIsVoiceRecording;     //是否正在录音
	LONG               m_lHandle;               //视频播放句柄  
	LONG               m_lVoiceHandle;			//语音对讲句柄
	LONG               m_lVoiceForwardHandle;	//语音转发句柄
	QString            m_sRtspUrl;              //rtsp视频流
	SCamerInfo()
	{
		m_nDevTypeCode = 0;
		m_bConStatus = false;
		m_bIsRecording = false;
		m_bIsVoiceRecording = false;
		m_lHandle = -1;
		m_lVoiceHandle = -1;
		m_sRtspUrl = "";
	}
	//复位数据
	void resetData()
	{
		m_nDevTypeCode = 0;
		m_bConStatus = false;
		m_bIsRecording = false;
		m_bIsVoiceRecording = false;
		m_lHandle = -1;
		m_lVoiceHandle = -1;
		m_sRtspUrl = "";
	}
};

class CDevDataCam
{
public:
	CDevDataCam();
	~CDevDataCam();

	/**
	* @ Author: Gaojia
	* @ Description: 云台配置信息
	*/
	QString  m_sRobHostGuid;				//机器人主机设备Guid
	QString  m_sCamerGuid;					//云台Guid
	bool     m_bInit;                       //云台设备是否已经初始化
	bool     m_bLogin;                      //云台设备是否连接
	bool     m_bCheckTemp;                  //测温模式是否设置成功
	QString  m_sCamerName;					//云台名称
	QString  m_sCamerType;					//云台类型
	QString  m_sIRCamerCode;				//红外相机类型编码
	QString  m_sImageCamerCode;				//图像相机类型编码
	QString  m_sAudioDeviceCode;			//语音设备类型编码
	QString  m_sCamerIp;                    //云台ip
	int      m_nCamerPort;                  //云台端口号
	QString  m_sUserName;                   //用户名
	QString  m_sPassWord;                   //密码
	QString  m_sRecordPath;					//手动录像拍照保存的路径
	QString  m_sCamerObsConfig;				//云台避障配置
	int      m_nBroadcastTime;				//音频转发间隔时间

	int m_nDrawType;	//0:机器人绘制 1;跑偏绘制

	int m_nRollerNum;  //托辊号
	int m_nBelogn;    //AB侧托辊
	QString m_sRollerDesc;

	//跑偏画线和左下角文字相关
	QPointF m_BeltEdgePf1;//皮带边缘点1 左上
	QPointF m_BeltEdgePf2;//皮带边缘点2 右上
	QPointF m_BeltEdgePf3;//皮带边缘点3 右下
	QPointF m_BeltEdgePf4;//皮带边缘点4 左下
	double m_dLeftRectifyValue;//左偏值
	double m_dRightRectifyValue;//右偏值
	int m_nRectifySetValue;//一级跑偏判定值
	int m_nRectifySetValueTwo;//二级跑偏判定值
	int m_nIsHaveBeltState;
	bool m_bBeltState;

	STRU_DEVICE_INFO m_sStruDeviceInfo;

	QMap<int, SCamerInfo> m_cMapCamerInfo;//设备状态数据 给无画面执行任务录像使用 每一个设备对应一个对象 int 设备id 如红外相机  图像相机和语音设备
	QMap<HWND, SCamerInfo>m_cMapHandInfo; //界面视频状态管理数组
	QString m_sRtspUrlImg;                //可见光rtsp视频地址
	QString m_sRtspUrlIr;                 //红外rtsp视频地址
	bool m_bIsOpenTalkBack;
	double m_dAtcTempMax;                   //最高温度
	double m_dAtcTempMin;                   //最低温度
	double m_dAtcTempAverage;               //平均温度
	double m_dAtcDecibel;                   //声音分贝值
};

#endif